package leetcode.simple;

public class Test9 {
    public static void main(String[] args) {
        boolean palindrome = isPalindrome(-1);
        System.out.println(palindrome);

    }

    public static boolean isPalindrome(int x) {
        if (x<0){
            return false;
        }
        if (x == 0){
            return true;
        }
        if (x % 10 == 0){
            return false;
        }
        int[] c = new int[20];
        int i =0;
        while (x > 0){
            int y = x % 10;
            c[i] = y;
            i++;
            x= x/10;
        }
        int start = 0,end = i-1;
        while (start<end){
            if (c[start] == c[end]){
                start++;
                end--;
            }
            else{
                return false;
            }
        }
        return true;
    }
}
